<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
	</body>
	<script type="text/javascript">
		var str = "abcdefg"
		//判断str是否以a开头？(给定字符串然后他的索引值为0)
		var num = str.indexOf("abcdefg");
		//只有返回值为0,那么字符串才是以参数为开头
		//如果查询不到,返回值为-1
		alert(num);
	</script>
</html>
